package com.wsoft.email;

import com.wsoft.response.ResponseResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author Zhang gukai
 * @Date 2024/11/27 10:50
 */

@RestController
@RequestMapping("/sys/email")
public class EmailController {
    @Resource
    private EmailService emailService;
    @GetMapping("/send")
    public ResponseResult send(){
        //收件人信息
        String to="845959011@qq.com";
        //邮件标题
        String title="发送邮件测试";
        //邮件内容
        String content="<h1>Task List</h1>\n" +
                "<ul>\n" +
                "        <li>\n" +
                "            <strong>Task 1</strong>\n" +
                "                <span style=\"color: red;\">(Pending)</span>\n" +
                "            <div style=\"margin-left: 20px;\">\n" +
                "                <p>Description 1</p>\n" +
                "                    <button>Mark as Completed</button>\n" +
                "            </div>\n" +
                "        </li>\n" +
                "        <li>\n" +
                "            <strong>Task 2</strong>\n" +
                "                <span style=\"color: green;\">(Completed)</span>\n" +
                "            <div style=\"margin-left: 20px;\">\n" +
                "                <p>Description 2</p>\n" +
                "            </div>\n" +
                "        </li>\n" +
                "        <li>\n" +
                "            <strong>Task 3</strong>\n" +
                "                <span style=\"color: red;\">(Pending)</span>\n" +
                "            <div style=\"margin-left: 20px;\">\n" +
                "                <p>Description 3</p>\n" +
                "                    <button>Mark as Completed</button>\n" +
                "            </div>\n" +
                "        </li>\n" +
                "        <li>\n" +
                "            <strong>Task 3</strong>\n" +
                "                <span style=\"color: red;\">(Pending)</span>\n" +
                "            <div style=\"margin-left: 20px;\">\n" +
                "                <p>Description 4</p>\n" +
                "                    <button>Mark as Completed</button>\n" +
                "            </div>\n" +
                "        </li>\n" +
                "</ul>\n" +
                "<h2>Statistics</h2>\n" +
                "<p>Total Tasks: 4</p>\n" +
                "<p>Completed Tasks: 1</p>\n" +
                "<p>Pending Tasks: 2</p><p>Pending Tasks: 3</p>";
        //邮件内容
        String type="html";
        //发送
        boolean flag=emailService.send(to,title,content,type);
        return ResponseResult.success(flag);
    }



}
